public class Test {
    public static void main(String[] args) {
        /*int a = 10;
        long b = 100L;
        b = a;
        a = (int)b;
        System.out.println(a);
        System.out.println(b);*/

        /*int a = 10;
        long b = 20;
        int c = (int)(a + b);
        long d = a + b;*/

        /*byte a = 10;
        byte b = 20;
        byte c = (byte)(a + b);
        System.out.println(c);*/

        //对于 short, byte 这种比 4 个字节小的类型, 会先提升成 4 个字节的 int , 再运算.

        /*String s1 = "hello";
        String s2 = " world";
        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s1+s2); // s1+s2表示：将s1和s2进行拼接 hello world*/

        /*String str1 = 10 + 20 + "a";
        String str2 = "a" + 10 +20;
        System.out.println(str1);//30a
        System.out.println(str2);//a1020*/

        //int转换成String
        /*int num = 10;
        // 方法1
        String str1 = num + "";
        // 方法2
        String str2 = String.valueOf(num);
        System.out.println(str1);//10
        System.out.println(str2);//10*/

        /*//String转换成int
        String str = "100";
        int num = Integer.parseInt(str);*/

        /*System.out.println(10 > 20 && 10 / 0 == 0); // false
        System.out.println(10 < 20 || 10 / 0 == 0); // true*/

        /*System.out.println(10 > 20 & 10 / 0 == 0); // 程序抛出异常
        System.out.println(10 < 20 | 10 / 0 == 0); // 程序抛出异常*/

        /*int a = 10;
        int b = 20;
        int max = a > b ? a : b;
        System.out.println(max);//20*/

        int a = 10;
        int b = 20;
        int c = a + (b - a) >> 1;
        System.out.println(c);//10
    }
    public static void main3(String[] args) {
        /*long a = 10L;//一般用大写L 好区分
        System.out.println(Long.MAX_VALUE);
        System.out.println(Long.MIN_VALUE);*/

        /*int的包装类型为Integer
        long的包装类型为Long
        short的包装类型为Short
        short的表示范围是-32768 - 32767
        字节的包装类型为Byte
        double的包装类型为Double
        float的包装类型为Float
        boolean的包装类型Boolean*/

        /*double d = 3.14;
        System.out.println(d);//3.14*/

/*        int a = 1;
        int b = 2;
        System.out.println(a / b);//0*/

        /*double a = 1.0;
        double b = 2.0;
        System.out.println(a / b);//0.5

        double num = 1.1;
        System.out.println(num * num);//1.1*1.1   1.2100000000000002*/

        /*char c1 ='A'; // 大写字母
        char c2 = '1'; // 数字字符
        System.out.println(c1);
        System.out.println(c2);
        // 注意：java中的字符可以存放整形*/

        /*char c3 = '帅';
        System.out.println(c3);

        char ch = '呵';
        System.out.println(ch);*/


    }
    public static void main2(String[] args) {
//        int a = 10;
//        System.out.println(!a);//err  !只能用在布尔类型中
    }
    public static void main1(String[] args) {
//        short a = 128;
//        byte b = (byte) a;
//        System.out.println(a);
//        System.out.println(b);

//        byte a = 130;
//        float b = 3.5;
//        System.out.println(a);

//        int  a = 3;
//        byte b = a;

        double x = 2.0;
        int y = 4;
        x /= ++y;//x = x / (++y)   x = x / 5  x = 2.0 / 5  x = 0.4
        System.out.println(x);
    }
}
